<include file="public@header"/>
<style>
.breadcrumb {
  padding: 8px 15px;
  margin-bottom: 20px;
  list-style: none;
  background-color: #f5f5f5;
  border-radius: 4px;
  font-size: 20px;
}
.breadcrumb > li + li:before {
    color: #CCCCCC;
    content: "-> ";
    padding: 0 5px;
	font-size: 30px;
}
</style>
</head>
<body>
<div class="wrap js-check-wrap">
	<ol class="breadcrumb">
		<li><a href="{:url('Classroom/campus')}">{$campus['name']|default='校区'}</a></li>
		<li class="active">修改班级</li>
	</ol>
    <form action="{:url('Class/edit_class_post')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
	<input type="hidden" value="{$param['id']|default='0'}" name="class_id" />
        <div class="row">
            <div class="col-md-6">
                <table class="table table-bordered">
					<tr>
                        <th width="100">分类<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" required
                                   value="{$param['category_titles']}"
                                   placeholder="请选择分类" onclick="doSelectCategory();" id="js-categories-name-input"
                                   readonly/>
                            <input class="form-control" type="hidden" value="{$param['categories']}"
                                   name="categories"
                                   id="js-categories-id-input"/>
                        </td>
                    </tr>
					<tr>
                        <th width="100px">教室<span class="form-required">*</span></th>
                        <td>
                            <select class="form-control" name="classroom_id">
								{$classroom_tree|default='请先添加教室！'}
							</select>
                        </td>
                    </tr>
					<tr>
                        <th width="100px">任课老师<span class="form-required">*</span></th>
                        <td>
                            <select class="form-control" name="teacher">
								{$teacher_tree|default='请先添加教师！'}
							</select>
                        </td>
                    </tr>
                    <tr>
                        <th width="100px">班级名称<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" name="name"
                                   id="name" required="required" value="{$param['name']|default=''}" placeholder="请输入班级名称"/>
                        </td>
                    </tr>
                    <tr>
                        <th>课次<span class="form-required">*</span></th>
                        <td>
                            <input class="form-control" type="text" required="required" name="class_number" id="class_number" value="{$param['class_number']|default=''}" onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入课次">
                        </td>
                    </tr>
                    <tr>
                        <th>满班人数</th>
                        <td>
						<span>
                            <input class="form-control" type="text" onkeyup="value=value.replace(/[^\d]/g,'')" name="student_number" id="student_number" value="{$param['student_number']|default=''}"
                                   placeholder="不填则默认等于教室容量">
							</span>
                        </td>
                    </tr>
                </table>
				
            </div>
            <div class="col-md-6">
			
            </div>
				<div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
                        <input class="btn btn-primary" type="button" value="返回" onclick="javascript:history.back(-1)"></input>
                    </div>
                </div>	
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    function doSelectCategory() {
        var selectedCategoriesId = $('#js-categories-id-input').val();
        openIframeLayer("{:url('SchoolCategory/select')}?ids=" + selectedCategoriesId, '请选择分类', {
            area: ['700px', '400px'],
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                //do something

                var iframeWin          = window[layero.find('iframe')[0]['name']];
                var selectedCategories = iframeWin.confirm();
                if (selectedCategories.selectedCategoriesId.length == 0) {
                    layer.msg('请选择分类');
                    return;
                }
                $('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
                $('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
                //console.log(layer.getFrameIndex(index));
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });
    }
</script>
</body>
</html>